package com.yxj05;

import java.util.TreeSet;

public class TreeSetDemo2 {
    public static void main(String[] args) {
        TreeSet<Student> ts = new TreeSet<Student>();
        Student s1 = new Student("xishi",23);
        Student s2 = new Student("wangzhaojun",18);
        Student s3 = new Student("yangyuhuan",20);
        Student s4 = new Student("diaochan", 13);
        Student s5 = new Student("yangxuejiao", 13);
        Student s6 = new Student("yangxuejiao", 13);
        ts.add(s1);
        ts.add(s2);
        ts.add(s3);
        ts.add(s4);
        ts.add(s5);
        ts.add(s6);
        for(Student s : ts) {
            System.out.println(s.getName()+","+s.getAge());
        }
    }
}
